const Sub = {
	subs: {},
	$on(topic: string, callback: () => void) {
		this.subs[topic] = callback
	},
	$trigger(topic, data) {
		this.subs[topic] && this.subs[topic](data)
	},
	$once(topic: string, callback: () => void) {
		this.$on(...arguments)
	},
}

export default Sub
